package com.play.game.mydb.db;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.widget.Toast;

/**
 * Created by 聪明一只哈 on 2018/4/22.
 * Time: 2018/4/22  15:09
 */

public class MyDatabsesHelper extends SQLiteOpenHelper {

    public static final String CREATE_BOOK  ="create table book("
            +"id integer primary key autoincrement, "
            +"author text,"
            +"price real,"
            +"pages integer,"
            +"name text)";
    private Context context;

    public MyDatabsesHelper(Context context) {
        super(context, "BookStore.db", null, 1);
        this.context = context;
    }

    @Override
    public void onCreate(SQLiteDatabase sqLiteDatabase) {
        sqLiteDatabase.execSQL(CREATE_BOOK);
        Toast.makeText(context, "数据库创建!", Toast.LENGTH_SHORT).show();

    }

    @Override
    public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {

    }
}
